<?php

require './conn.php' ;

$json=[];

// 检测连接
if ($conn->connect_error) {
	$json["is_s"]="false";
	$json["info"]="can't connect mysql: " . $conn->connect_error;
	die(json_encode($json));
} 
//echo "连接成功";

//通过考试号获取ID信息
//$ksh="19432827150593";

if (isset($_GET['ksh'])){
	$ksh=$_GET['ksh'];
}  else{
	$json["is_s"]="false";
	$json["info"]="please set GET's param";
	die(json_encode($json));
}
$sql = "SELECT * FROM 2019_the_last WHERE 考生号='".$ksh."'";
//$sql = "SELECT * FROM 2019_zj";
$result = $conn->query($sql);
 
if ($result->num_rows > 0) {
    // 输出数据
	$row = $result->fetch_assoc();
   // while($row = $result->fetch_assoc()) {
	   
	   $json["ksh"]=$row["考生号"];
	   $json["xm"]=$row["姓名"];
	   $json["xb"]=($row["性别"]==1?"男":"女");
	   $json["tdcj"]=round($row["成绩"],2);
	   $json["lqzy"]=$row["录取专业"];
	   $json["sjr"]=$row["收件人"];
	   $json["sjdz"]=$row["家庭地址"];
	   $json["is_s"]="true";
	   
   // }
} else {
	$json["is_s"]="false";
	$json["info"]="抱歉，录取名单中并未有您的信息。请您再次确认输入信息是否有误。你也可以致电我院招生办，咨询详情。";
}
echo json_encode($json);
$conn->close();

?>